package net.simflow.swf.analyzer.network.opt;

import java.util.HashSet;

import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.core.Workflow;
import uk.org.taverna.scufl2.api.port.InputWorkflowPort;

public class InputPortSetExtracter {

	private static InputPortSetExtracter instance = new InputPortSetExtracter();

	private InputPortSetExtracter() {
	}

	public static InputPortSetExtracter getInstance() {
		return instance;
	}

	public HashSet<InputWorkflowPort> extract(WorkflowBundle workflowBundle) {
		HashSet<InputWorkflowPort> set = new HashSet<InputWorkflowPort>();
		for (Workflow wf : workflowBundle.getWorkflows()) {
			set.addAll(wf.getInputPorts());
		}

		return set;
	}
}
